<?php
if (!preg_match('/[a-z0-9]{32,32}/', $_GET["token"])) {
	$arr = array('error_code' => '-1', 'error_msg' => "非法访问", 'timestamp' => time());
	echo json_encode($arr);
} else {
	include 'action/setting.php';
	$con = mysqli_connect($sqldatabase, $sqlusername, $sqlpassword,$sqltable);
	
	mysqli_query($con,'set names utf8'); 
	$result = mysqli_query($con,"SELECT * FROM softlic where usertoken='" . $_GET['token'] . "'");
	$ver = "";
	$uid = "";
	while ($row = mysqli_fetch_array($result)) {
		$ver = $row['is_can'];
		$uid = $row['uid'];
	}
	$result = mysqli_query($con,"SELECT * FROM softset where uid='" . $uid . "'");
	$err_z_lic = "";
	$err_o_lic = "";
	$err_t_lic = "";
	while ($row = mysqli_fetch_array($result)) {
		$err_z_lic = $row['err_z_lic'];
		$err_o_lic = $row['err_o_lic'];
		$err_t_lic = $row['err_o_lic'];
	}
	if ($ver == "0") {
		$arr = array('error_code' => '0', 'error_msg' => $err_z_lic, 'timestamp' => time());
		echo json_encode($arr);
	} else if ($ver == "1") {
		$arr = array('error_code' => '1', 'error_msg' => $err_o_lic, 'timestamp' => time());
		echo json_encode($arr);
	} else {
		$arr = array('error_code' => '2', 'error_msg' => "授权验证失败，授权不存在", 'timestamp' => time());
		echo json_encode($arr);
	}
}
?>